package root.bignerdranch.wlyy;

import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.bignerdranch.wlyy.R;

import androidx.appcompat.app.AppCompatActivity;

public class WEBVIEW extends AppCompatActivity{
    private WebView webview;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.webview);

        //创建WebView实例
        webview = (WebView) findViewById(R.id.webview);
        webview.loadUrl("http://www.baidu.com");
        webview.setWebViewClient(new WebViewClient(){
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                view.loadUrl(url);
                return true;
            }
        });
    }

}

